<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>百度在线考试平台——班级管理列表</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <script src="/bootstrap/js/jquery.min.js"></script>
    <script src="/bootstrap/js/bootstrap.min.js"></script>
    <style>
        table {
            border-collapse: collapse;
            width: 100%;
        }

        th, td {
            padding: 8px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="panel panel-success">
        <div class="panel-heading panel-title text-center">
            <h1>班级管理列表</h1>
            <div style="display: flex;">
                <input type="text" style="width:80px" class="form-control" placeholder="用户id号..." >
                <input type="text" style="width:80px" class="form-control" placeholder="用户名..." >
            </div>
        </div>
        <%--        <form action="users/allUsers">--%>

        <div class="panel-body">
            <table>
                <tr>
                    <th>班级名称</th>
                    <th>创建人ID</th>
                    <th>创建时间</th>
                    <th>操作</th>
                    <th><button onclick="add()" >添加</button></th>
                </tr>
                <%-- 使用JSP标签循环遍历并渲染User数据 --%>
                <c:forEach var="clazz" items="${clazzList}">
                    <tr>
                        <td>${clazz.name}</td>
                        <td>${clazz.userId}</td>
                        <td>${fn:substring(clazz.createTime,0,16)}</td>
                        <td><button onclick="select(${clazz.id})">查看</button>
                        <button onclick="delet(${clazz.id})">删除</button></td>
                    </tr>
                </c:forEach>
            </table>
        </div>
        <%--        </form>--%>
        <div class="panel-footer text-right">
            百度在线考试平台
        </div>
    </div>
</div>
</body>
<script>
    function add(){
        location.href="/clazzs/addClazz"
    }
    function delet(id){
        location.href="/clazzs/deleteClazz/"+id;
    }
    function select(id){
        location.href="/clazzs/selectClazz/"+id;
    }
</script>
</html>
